import { expect } from 'chai';
import compareVersion from '../src/compareVersion';

describe('compareVersion unit test', function() {
    it('should throw error', function() {
        expect(compareVersion()).to.be.equal(0);
    });

    it('should return -1', function() {
        expect(compareVersion('1.0.0', '2.0.0')).to.be.eql(-1);
    });

    it('should return 0', function() {
        expect(compareVersion('1.0.0', '1.0.0')).to.be.eql(0);
    });

    it('should return negative', function() {
        expect(compareVersion('1.0', '1.0.1')).to.be.eql(-1);
    });

    it('should return positive', function() {
        expect(compareVersion('1.0.1', '1.0')).to.be.eql(1);
    });

    it('should return 0', function() {
        expect(compareVersion('1.0.0', '1.0')).to.be.eql(0);
    });

    it('should return negative', function() {
        expect(compareVersion('1', '1.1')).to.be.eql(-1);
    });

    it('should return negative', function() {
        expect(compareVersion('2.1.14', '2.11.3')).to.be.eql(-1);
    });

    it('should return negative', function() {
        expect(compareVersion('v2.1.14', 'v2.11.3')).to.be.eql(-1);
    });

    it('should return negative', function() {
        expect(compareVersion('2.1.14', 'v2.11.3')).to.be.eql(-1);
    });
});
